package com.wanwu.channel.server.controller;


import com.wanwu.channel.remote.alipay.config.AlipayConfiguration;
import com.wanwu.channel.remote.alipay.config.ZfbGlobalConfiguration;
import com.wanwu.channel.server.process.AlipayNotifyProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@RestController
@EnableConfigurationProperties(ZfbGlobalConfiguration.class)
@RequestMapping("/alipay/apppay")
public class AlipayAppPayController {

    private static final Logger logger = LoggerFactory.getLogger(AlipayAppPayController.class);

    @Autowired
    private AlipayConfiguration alipayConfiguration;

    @Autowired
    private AlipayNotifyProcess alipayNotifyProcess;


    /**
     * @param request
     * @return
     */
    private Map<String, String> getRequestParams(HttpServletRequest request) {

        Map<String, String> params = new HashMap<String, String>();
        if (null != request) {
            Set<String> paramsKey = request.getParameterMap().keySet();
            for (String key : paramsKey) {
                params.put(key, request.getParameter(key));
            }
        }
        return params;
    }

}
